/**
 * Created by shaotingzhou on 2017/5/10.
 */
// 使用情况情况的中部
import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    Image,
    TouchableOpacity,
    Dimensions
} from 'react-native';
import SongInfo from  './songInfo/songInfo'
var {width,height} = Dimensions.get('window');

export default class SongItem extends Component {

    render() {
        const rowData = this.props.rowData
        return (
            <View style={{height:70,justifyContent:'space-between'}}>
                <View style={{flexDirection:'row',justifyContent:'space-between'}}>
                    <View style={{justifyContent:'space-around',marginTop:10}}>
                        <Text style={{marginLeft:5,fontSize:14,width:width - 50}}  >歌曲: {rowData.title}</Text>
                        <Text style={{marginLeft:10,marginTop:5,fontSize:14,color:'#969696',width:width - 50}}>歌手: {rowData.nickname}</Text>
                        <Text style={{marginLeft:10,fontSize:14,width:width - 50,color:rowData.duration % 2 == 0 ? "black" :"#969696"}}>{rowData.duration % 2 == 0 ? "下载" :"已下载"}</Text>
                    </View>

                    <View style={{marginRight:5}}>
                        <TouchableOpacity onPress={()=>this.songInfo()}>
                            <Image source={require('../../image/统计.png')} style={{width:20,height:20,marginTop:5}} />
                        </TouchableOpacity>
                        <TouchableOpacity onPress={()=>this.passMethod()}>
                            <Image source={rowData.isPaid == false ? require('../../image/暂停.png') : require('../../image/播放.png')} style={{width:20,height:20,marginTop:10}} />
                        </TouchableOpacity>
                    </View>
                </View>

                <View style={{height:1,backgroundColor:'#DEDEDE'}}></View>

            </View>
        );
    }

    songInfo = () =>{
         this.props.mynavigator.push({
             component:SongInfo
         })
    }

    passMethod = () =>{
       this.props.playSong()
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
    }
});